import financeapi.*;

public class TestAuthorizeCallback extends AuthorizeCallback
{
	private boolean wait;
	private AuthorizeObject o;

	public TestAuthorizeCallback()
	{
		wait = true;
	}

	public boolean keepWaiting()
	{
		synchronized(this)
		{
			return wait;
		}
	}

	public void onAuthorize(AuthorizeObject obj)
	{
		synchronized(this)
		{
			o = obj;
			if(obj.authorize())
				System.out.println("We are authorized");
			else
				System.out.println("Authorization Failed");
			wait = false;
		}
	}

	public AuthorizeObject getAuthorization()
	{
		synchronized(this)
		{
			return o;
		}
	}
}
